<?php
/*
 * 进云智能生成平台
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
 */

defined('BY_JYA') or exit('error');
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['setting']=$this->plugin_setting('basic');
$uniacid=$_SESSION['uniacid'];
if($_RQ['op']=='main'){
	$return['post']=array('hid'=>$_RQ['id']);
	exi($return);
}
if($_RQ['op']=='post'){
	$post=get_postdata();
	if(empty($post['name'])){
		exi('请输入您的姓名！','error');
	}
	if(empty($post['mobile'])){
		exi('请输入您的电话！','error');
	}
	if($post['shenfen']==''){
		exi('请选择您的身份！','error');
	}
	if(!$post['hid']){
		exi('请选择您的房屋！','error');
	}
	$isexist=pdo_get('jy_smallquan_household',array('hid'=>$post['hid'],'uniacid'=>$uniacid,'mid'=>$_SESSION['uid']));
	$data=array(
			'uniacid'=>$uniacid,
			'mid'=>$_SESSION['uid'],
			'hid'=>$post['hid'],
			'name'=>trim($post['name']),
			'mobile'=>trim($post['mobile']),
			'shenfen'=>intval($post['shenfen']),
			'status'=>0,
		
		);
	if(!$isexist['id']){
	//	print_r('charu');exit;
		$data['createtime']=TIMESTAMP;
		pdo_insert('jy_smallquan_household',$data);
	}else{
		//	print_r('gengxin');exit;
		pdo_update('jy_smallquan_household',$data,array('id'=>$isexist['id']));
	}
	
	exi('提交成功！','','/myhome/');
}

		
		


